package com.citcc.business.bean;

import com.citcc.common.annotation.Excel;
import com.citcc.common.utils.StringUtils;

import java.util.Date;

public class WarnExport {

    /**
     * 主键id
     */
    private String id;
    /**
     * 修改时间
     */
    private Date updateTime;

    /**
     * 0:未删除 1:删除
     */
    private String delFlag;

    /**
     * 桩号
     */
    @Excel(name = "桩号")
    private String stakeCode;

    /**
     * 枪号
     */
    @Excel(name = "终端号(枪号)",readConverterExp = ",2=B枪,1=A枪,0=null,null=")
    private String gunCode;

    /**
     * 站号
     */
    @Excel(name = "站号")
    private String stationCode;

    /**
     * 充电站名称
     */
    @Excel(name = "站名")
    private String stationName;
    /**
     * 告警点
     */
    @Excel(name = "告警类型",readConverterExp = "1-1=触摸屏,1-2=读卡器,1-3.4=打印机,1-5电能表," +
            "1-6.7.8=连接确认,2-1.2=A相输入,2-3.4=B相输入,2-5.6=C相输入,2-7.8=输出过流,3-1=急停,3-2=防雷器,3-3=电池连接状态,3-4=充电机监控通讯,3-5,6=直流母线绝缘,3-7,8=单体电池,4-1=风扇,4-2=温度传感器,4-3=系统温度,4-4=BMS 通讯,5-1=交流输入欠压," +
            "5-2=交流输入过压,5-3=输出过压,5-4=充电模块监控响应超时,5-5=模块通信中断,5-6=模块过温,5-7=模块故障,5-8=模块保护,6-1=充电枪故障,6-2=握手超时,6-3=配置超时,6-4=接收充电请求指令超时," +
            "6-5=模块交流缺相告警,6-6=模块严重不均流,6-7=门禁开关告警,6-8=电池异常,7-1=系统倾倒或严重振动,7-2=充电枪连接异常,7-3=放电电阻异常,7-4=枪头温度过高,7-5=K1 接触器异常," +
            "7-6=系统输出过流,7-7=U3-U3 通信异常,7-8=电子锁异常,null=")
    private String warnSpot;
    /**
     * 告警描述
     */
    @Excel(name = "告警描述",readConverterExp = "1=正常,2=通讯故障,3=断开,4=A 相过压," +
            "5=A相欠压,6=B相过压,7=B相欠压,8=C相过压,9=C相欠压,10=过流,11=急停拍下," +
            "12=防雷器故障,13=反接,14=绝缘下降,15=母线过压,16=单体电池过温,17=风扇故障," +
            "18=过温故障,19=故障,null=")
    private String warnDesc;
    /**
     * 是否影响充电0无1有
     * @return
     */
    @Excel(name = "是否影响充电",readConverterExp = "0=无影响,1=有影响,null=")
    private String isEffect;
    /**
     * 开始时间
     */
    @Excel(name = "状态开始时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;
    /**
     * 结束时间
     */
    @Excel(name = "告警结束时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;
    /**
     * 告警时长
     */
    @Excel(name = "告警时长")
    private String warnTime;
    /**
     * 创建时间
     */
    @Excel(name = "创建时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    /**
     * 告警类型
     */
    private String warnType;

    /**
     * 告警状态
     */
    private String warnStatus;
    /**
     * 告警名称
     */
    private String warnName;
    /**
     * 查询结束时间
     * @return
     */
    private String beginTime;
    private String endDate;

    public String getIsEffect() {
        return isEffect;
    }

    public void setIsEffect(String isEffect) {
        this.isEffect = isEffect;
    }

    public String getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(String beginTime) {
        this.beginTime = beginTime;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    public String getGunCode() {
        return gunCode;
    }

    public void setGunCode(String gunCode) {
        this.gunCode = gunCode;
    }

    public String getStakeCode() {
        return stakeCode;
    }

    public void setStakeCode(String stakeCode) {
        this.stakeCode = stakeCode;
    }

    public String getStationCode() {
        return stationCode;
    }

    public void setStationCode(String stationCode) {
        this.stationCode = stationCode;
    }

    public String getWarnType() {
        return warnType;
    }

    public void setWarnType(String warnType) {
        this.warnType = warnType;
    }

    public String getWarnName() {
        return warnName;
    }

    public void setWarnName(String warnName) {
        this.warnName = warnName;
    }

    public String getWarnTime() {
        return warnTime;
    }

    public void setWarnTime(String warnTime) {
        this.warnTime = warnTime;
    }

    public String getStationName() {
        return stationName;
    }

    public void setStationName(String stationName) {
        this.stationName = stationName;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public String getWarnSpot() {
        return warnSpot;
    }

    public void setWarnSpot(String warnSpot) {
        this.warnSpot = warnSpot;
    }

    public String getWarnDesc() {
        return warnDesc;
    }

    public void setWarnDesc(String warnDesc) {
        if (StringUtils.isNotEmpty(warnDesc)){
            String type = this.getWarnSpot();
            if("1-1".equals(type) || "1-2".equals(type) || "1-3.4".equals(type) || "1-5".equals(type) || "3-4".equals(type) ||
                    "4-4".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "2";
                }
            }else if("1-6.7.8".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "3";
                }
            }else if("2-1.2".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "4";
                }else if("2".equals(warnDesc)){
                    this.warnDesc = "5";
                }
            }else if("2-3.4".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "6";
                }else if("2".equals(warnDesc)){
                    this.warnDesc = "7";
                }
            }else if("2-5.6".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "8";
                }else if("2".equals(warnDesc)){
                    this.warnDesc = "9";
                }
            }else if("2-7.8".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "10";
                }
            }else if("3-1".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "11";
                }
            }else if("3-2".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "12";
                }
            }else if("3-3".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "13";
                }
            }else if("3-5,6".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "14";
                }else if("2".equals(warnDesc)){
                    this.warnDesc = "15";
                }
            }else if("3-7,8".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "15";
                }else if("2".equals(warnDesc)){
                    this.warnDesc = "16";
                }
            }else if("4-1".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "17";
                }
            }else if("4-3".equals(type)){
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "18";
                }
            }else{
                if("0".equals(warnDesc)){
                    this.warnDesc = "1";
                }else if("1".equals(warnDesc)){
                    this.warnDesc = "19";
                }
            }
        }else{
            this.warnDesc = warnDesc;
        }
    }

    public String getWarnStatus() {
        return warnStatus;
    }

    public void setWarnStatus(String warnStatus) {
        this.warnStatus = warnStatus;
    }

}
